#include <REGX52.H>
#include<intrins.h>


//443无线接收
sbit on  = P1^1;
sbit off = P1^2;

//振动器
sbit vibrate = P1^3;

//报警器
sbit switcher = P1^0;

void Delay2000ms()		//@11.0592MHz
{
	unsigned char i, j, k;

	_nop_();
	i = 15;
	j = 2;
	k = 235;
	do
	{
		do
		{
			while (--k);
		} while (--j);
	} while (--i);
}



int main(){

		int change = 0;
		while(1){
		
			if(on == 1){
				change = 1;
			}
			if(off == 1){
				change = 0;
			}
			
			if(change == 1){
			
				if(vibrate == 0){
					
						switcher = 0;
						Delay2000ms();
						switcher = 1;
				}
			}
		}
	return 0;
}



